package com.zhangxu.microservice.auth.mapstruct;

import com.zhangxu.microservice.auth.biz.dto.CreateResourceDTO;
import com.zhangxu.microservice.auth.biz.dto.ResourceDTO;
import com.zhangxu.microservice.auth.biz.dto.UpdateResourceDTO;
import com.zhangxu.microservice.auth.vo.req.CreateResourceReq;
import com.zhangxu.microservice.auth.vo.req.UpdateResourceReq;
import com.zhangxu.microservice.auth.vo.resp.ResourceResp;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 资源Web层对象转换接口
 */
@Mapper(componentModel = "spring")
public interface ResourceWebConverter {

    /**
     * CreateResourceReq 转 CreateResourceDTO
     *
     * @param createResourceReq 创建资源请求
     * @return 创建资源DTO
     */
    CreateResourceDTO toCreateResourceDTO(CreateResourceReq createResourceReq);

    /**
     * UpdateResourceReq 转 UpdateResourceDTO
     *
     * @param updateResourceReq 更新资源请求
     * @return 更新资源DTO
     */
    @Mapping(target = "id", ignore = true)
    UpdateResourceDTO toUpdateResourceDTO(UpdateResourceReq updateResourceReq);

    /**
     * ResourceDTO 转 ResourceResp
     *
     * @param resourceDTO 资源DTO
     * @return 资源响应
     */
    ResourceResp toResourceResp(ResourceDTO resourceDTO);
}